#include "8259A.h"

void Dev8259AFirstInitialize(DWORD dwAttribute) {
  WRITE_PORT_BYTE(0x20, dwAttribute);
  WRITE_PORT_BYTE(0x21, dwAttribute >> 8);
  if (!(dwAttribute & DEV_8259A_INIT_SINGLE_MODE)) {
    WRITE_PORT_BYTE(0x21, dwAttribute >> 16);
  }
  if (dwAttribute & DEV_8259A_INIT_NEED_ICW4) {
    WRITE_PORT_BYTE(0x21, dwAttribute >> 24);
  }
}

void Dev8259ASecondInitialize(DWORD dwAttribute) {
  WRITE_PORT_BYTE(0xA0, dwAttribute);
  WRITE_PORT_BYTE(0xA1, dwAttribute >> 8);
  if (!(dwAttribute & DEV_8259A_INIT_SINGLE_MODE)) {
    WRITE_PORT_BYTE(0xA1, dwAttribute >> 16);
  }
  if (dwAttribute & DEV_8259A_INIT_NEED_ICW4) {
    WRITE_PORT_BYTE(0xA1, dwAttribute >> 24);
  }
}
